package com.mall.shopping.dto;

import com.mall.commons.result.AbstractRequest;
import com.mall.commons.tool.exception.ValidateException;
import com.mall.shopping.constants.ShoppingRetCode;
import lombok.Data;

/**
 * Created on 2019/7/23.
 */
@Data
public class AddCartRequest extends AbstractRequest{

    private String userId;
    private Long productId;
    private Integer productNum;


    @Override
    public void requestCheck() {
        if(userId==null||productNum==null||productId==null){
            throw new ValidateException(
                    ShoppingRetCode.REQUEST_CHECK_FAILURE.getCode(),
                    ShoppingRetCode.REQUEST_CHECK_FAILURE.getMessage());
        }
    }
}
